package com.study.portal.controller.action;

import java.io.IOException;
import java.util.List;

import net.sf.json.JSONArray;

import com.study.portal.pojo.BbsType;
import com.study.portal.service.IBbsTypeService;
import com.study.portal.util.ActionUtil;

@SuppressWarnings("serial")
public class BbsTypeAction extends ActionSupport{
    private IBbsTypeService bbsTypeService;
    public void setBbsTypeService(IBbsTypeService bbsTypeService) {
        this.bbsTypeService = bbsTypeService;
    }
    
    private BbsType bbsType;

    public BbsType getBbsType() {
        return bbsType;
    }

    public void setBbsType(BbsType bbsType) {
        this.bbsType = bbsType;
    }

    public String goBbsTypeTree(){
        return "bbs_type_tree";
    }

    /**
     * Ajax请求方法
     * @return
     * @throws IOException
     */
    public String openList$() throws IOException{
        List<BbsType> bbsTypes = this.bbsTypeService.queryOpenList();
        ActionUtil.write(JSONArray.fromObject(bbsTypes).toString());
        System.out.println(JSONArray.fromObject(bbsTypes));
        //ActionContext.getContext().put("bbsTypes", bbsTypes);
        return null;
    }
}
